package com.example.dayu521.msg_receive.conf;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration(proxyBeanMethods = false)
public class WebMvc {

    //在gateway存在下,由gateway处理跨域
//    @Profile("prototype")
//    @Bean
//    public WebMvcConfigurer corsConfigurer() {
//        return new WebMvcConfigurer() {
//
//            @Override
//            public void addCorsMappings(CorsRegistry registry) {
//                registry.addMapping("/minio/**");
//            }
//
//        };
//    }

    @Bean
    public WebMvcConfigurer ktConfigurer() {
        return new WebMvcConfigurer() {
            public void addInterceptors(InterceptorRegistry registry) {
                registry.addInterceptor(new org.example.dayu521.conf.WebMvc.KTInterceptor()).addPathPatterns("/**");
            }

        };
    }


}

